<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>55社区</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="/theme/default/images/favicon.png">
    <jsp:include page="common.jsp"></jsp:include>
</head>
<body>
<header data-am-widget="header" class="am-header am-header-default sq-head ">
    <div class="am-header-left am-header-nav">
        <a href="javascript:history.back()" class="">
            <i class="am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="" class="">注册</a>
    </h1>
</header>
<div style="height: 49px;"></div>
<div class="login-logo">
    <img src="${ctx}/static/images/logo.png" />
</div>
<input type="text" name="name"  placeholder="请输入用户名" class="login-name">
<input type="text" name="mobile"  placeholder="请输入手机号" class="login-password">
<input type="password" name="password"  placeholder="请输入密码" class="login-name">
<input type="password" name="repassword"  placeholder="确认密码" class="login-password">
<div class="yzm">
    <input type="text" class="reg-yzm" placeholder="输入验证码" />
    <input type="button" class="yzm-hq" value="获取验证码" />
</div>
<div class="agree">
    <input type="checkbox" name="checkbox" value="同意" checked="">&nbsp;同意
    <a href="" class="xy">《我的55用户协议》</a>
    <div class="r-login">已有账号，请<a href="${ctx}/login.jsp" class="l-login">登录</a></div>
</div>
<input type="button" class="login-btn" value="立即注册">

<script>
    $(".login-btn").click(function () {
        var name=$("[name='name']").val().trim();
        var mobile=$("[name='mobile']").val().trim();
        var password=$("[name='password']").val().trim();
        var repassword=$("[name='repassword']").val().trim();
        var mydata={"name":name,"mobile":mobile,"password":password,"repassword":repassword};
        var checkbox=$("[name='checkbox']");
        for (var i = 0; i < checkbox.length; i++) {
            if (checkbox[i].checked){
                $.post("${ctx}/user/req.do",mydata,function (data) {
                    if (data.state == 0) {
                        window.location.href = "${ctx}/login.jsp"
                    } else {
                        alert(data.msg)
                        window.location.href;
                    }
                },"json")
            }else {
                alert("请同意协议");
            }
        }


    })
</script>

</body>
</html>

